Learn R Programming

fastR (version 1.1)

Column-wise medians: Colum-wise medians

Description

Colum-wise variances and standard deviations of a matrix

Usage

colMedians(x)

Arguments

x
A matrix with the data.

Value

A vector with the column medians.

Details

The functions is written in C++ in order to be as fast as possible.

See Also

colVars, colMeans (buit-in R function)

Examples

Run this code
x <- matrix( rnorm(100 * 1000), ncol = 1000 )
system.time( apply(x, 2, median) )
system.time( colMedians(x) )
a = apply(x, 2, median) 
b = colMedians(x) 
all.equal(a, b)

Run the code above in your browser using DataLab